package com.service.imple.admin;

import com.dao.AdminUserMapper;
import com.entity.AdminUser;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.service.admin.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AdminUserServiceImple implements AdminUserService {

    @Autowired
    private AdminUserMapper adminUserMapper;

    @Override
    public PageInfo selectByPage(Map param) {
        int pageNum=Integer.parseInt(param.get("pageNum").toString());
        PageHelper.startPage(pageNum,6);
        List<AdminUser> list = adminUserMapper.SelectPage(param);
        PageInfo<AdminUser> info =new PageInfo<>(list);
        return info;
    }

    @Override
    public List select(Map map) {
        return null;
    }

    @Override
    public int insert(AdminUser adminUser) {
        return adminUserMapper.insert(adminUser);
    }

    @Override
    public int update(AdminUser adminUser) {
        return adminUserMapper.updateByPrimaryKey(adminUser);
    }

    @Override
    public int delete(int id) {
        return adminUserMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<AdminUser> SelectAll(AdminUser adminUser) {
        return adminUserMapper.SelectAll(adminUser);
    }
}
